<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@page import="com.liuya.safe.policy.handler.QueryRawHandler" %>
<%@page import="com.liuya.db.sql.xml.QueryType" %>
<%@page import="com.liuya.db.sql.xml.Column" %>
<%@ page import="com.liuya.common.I18N" %>

<%
    I18N i18n = I18N.getWebInstance(request);
    QueryRawHandler handler = (QueryRawHandler) request.getAttribute("handler");
    QueryType query = handler.getQuery();
    Column column = (Column) request.getAttribute("column");
    String id = request.getParameter("id");

    String[][] mcpats = (String[][]) request.getAttribute("mappingClassPropertyAndTypes");
    String prop = "";
    String columnName = "";
    boolean readOnly = false;
    if (column != null) {
        prop = column.getProperty();
        readOnly = column.getReadOnly();
        columnName = column.getName();
    }
%>


<input type="hidden" name="oper" value="<%=column==null?"addProperty":"editProperty" %>"/>
<input type="hidden" name="index" value="<%=request.getParameter("index")%>"/>

<label><%=i18n.say("Column")%>
</label>
<input type="text" name="columnName" value="<%=columnName%>"/>
<label><%=i18n.say("Java_Property")%>
</label>
<select name="property">
    <%
        for (int i = 0; i < mcpats.length; i++) {
            String[] mcpat = mcpats[i];
            boolean selected = mcpat[0].equals(prop);
    %>
    <option value="<%=mcpat[0]%> &lt;<%=mcpat[1] %>&gt;" <%=selected ? "selected" : "" %>><%=mcpat[0]%>
        &lt;<%=mcpat[1] %>&gt;</option>
    <% } %>
</select>
<br/>
<label><%=i18n.say("Read_Only_Label")%>
</label>
<input type="radio" name="readOnly" value="false" <%=readOnly ? "" : "checked" %>/>False
<input type="radio" name="readOnly" value="true" <%=readOnly ? "checked" : "" %>/>True
